<php>
    $importCheckBox = true;
</php>
<php>
    $field['value_array'] = explode(',', $field['value']);
</php>
<volist name="field.opt" id="option">
    <php>
        $checked = in_array($key,$field['value_array']) ? 'checked' : '';
        $inputId = "id_$field[name]_$key";
    </php>
    <label for="{$inputId}" class="cbr-inline"> <input type="checkbox" value="{$key}" id="{$inputId}"
                                                       class="oneplus-checkbox"
                                                       data-field-name="{$field.name}" {$checked}/>
        {$option}</label>

</volist>
<input type="hidden" name="{$field.name}" class="oneplus-checkbox-hidden"
       data-field-name="{$field.name}" value="{$field.value}"/>
<script>
    (function () {
        $(".oneplus-checkbox").change(function () {
            // alert($(this).val());
            var checkboxs = $('.oneplus-checkbox');
            $('.oneplus-checkbox-hidden').val('');
            var data = '';
            for (var i = 0; i < checkboxs.length; i++) {
                if ($(checkboxs[i]).is(':checked')) {
                    if (i == checkboxs.length - 1) {
                        data += $(checkboxs[i]).val();
                    } else {
                        data += $(checkboxs[i]).val() + ',';
                    }
                }
            }
            $('.oneplus-checkbox-hidden').val(data);
            data = '';
        });
    })();
</script>